package com.wanshi.servlet;

import com.alibaba.fastjson.JSON;
import com.wanshi.entity.Result;
import com.wanshi.service.OrderService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/order/updateOrderById")
public class updateOrderById extends HttpServlet {

    private OrderService orderService = new OrderService();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //1 获取jsp传递的数据
        String orderid = request.getParameter("id");

        //2 操作数据库
        orderService.updateOrderById(orderid);


        //3 输出数据
        response.getWriter().write(JSON.toJSONString(Result.ok()));
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}

